//
//  SectionHeadView.m
//  ATMCash
//
//  Created by zhengchengfeng on 2024/9/11.
//

#import "SectionHeadView.h"

@implementation SectionHeadView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        self.backImgV = [[UIImageView alloc] init];
        [self addSubview:self.backImgV];
        [self.backImgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(15);
            make.right.equalTo(self.mas_right).offset(-15);
            make.top.equalTo(self.mas_top);
            make.bottom.equalTo(self.mas_bottom);
        }];
        
        
        self.titleLab = [Utility createLabel:[UIFont fontWithName:kFuturaMedium size:14] color:[UIColor colorWithHexString:@"#022D06"]];
        [self.backImgV addSubview:self.titleLab];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backImgV.mas_left).offset(15);
            make.right.equalTo(self.backImgV.mas_right).offset(-80);
            make.top.equalTo(self.backImgV.mas_top);
            make.bottom.equalTo(self.backImgV.mas_bottom);
        }];
        
        self.arrowIconV = [[UIImageView alloc] init];
        [self.backImgV addSubview:self.arrowIconV];
        [self.arrowIconV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.equalTo(@14);
            make.right.equalTo(self.backImgV.mas_right).offset(-15);
            make.height.equalTo(@10);
            make.centerY.equalTo(self.titleLab.mas_centerY);
        }];
        
        self.backImgV.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickTap)];
        [self.backImgV addGestureRecognizer:tap];
        
    }
    return self;
}


- (void)clickTap{
    if (_clickTapBlock) {
        _clickTapBlock();
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
